import mysql from "mysql2/promise"

// 创建数据库连接池
export const pool = mysql.createPool({
 host: process.env.MYSQL_HOST || "host.docker.internal"||"172.17.0.1",
 user: process.env.MYSQL_USER || "mn",
 password: process.env.MYSQL_PASSWORD,
 database: process.env.MYSQL_DATABASE || "blog",
 port: parseInt(process.env.MYSQL_PORT || "3306"),
 waitForConnections: true,
 connectionLimit: 10, // 连接池大小
 queueLimit: 0,
 // 禁用 SSL 验证以解决自签名证书问题
 ssl: {
   rejectUnauthorized: false
 }
})